@(collaborators: List[String],
  milestones: List[gitbucket.core.model.Milestone],
  priorities: List[gitbucket.core.model.Priority],
  defaultPriority: Option[gitbucket.core.model.Priority],
  labels: List[gitbucket.core.model.Label],
  customFields: List[gitbucket.core.model.CustomField],
  isManageable: Boolean,
  content: String,
  repository: gitbucket.core.service.RepositoryService.RepositoryInfo)(implicit context: gitbucket.core.controller.Context)
@import gitbucket.core.view.helpers
@gitbucket.core.html.main(s"New Issue - ${repository.owner}/${repository.name}", Some(repository)){
  @gitbucket.core.html.menu("issues", repository){
    <form action="@helpers.url(repository)/issues/new" method="POST" validate="true" class="form-group" autocomplete="off">
      <div class="row-fluid">
        <div class="col-md-9">
          <span id="error-title" class="error"></span>
          <input type="text" id="issue-title" name="title" class="form-control" value="" placeholder="Title" style="margin-bottom: 6px;" autofocus/>
          @gitbucket.core.helper.html.preview(
            repository         = repository,
            content            = content,
            enableWikiLink     = false,
            enableRefsLink     = true,
            enableLineBreaks   = true,
            enableTaskList     = true,
            hasWritePermission = isManageable,
            completionContext  = "issues",
            style              = "height: 200px; max-height: 500px;",
            elastic            = true
          )
          <div class="align-right">
            <input type="submit" class="btn btn-success" value="Submit new issue" onclick="javascript:return checkCustomFieldErrors();"/>
          </div>
        </div>
        <div class="col-md-3">
          @gitbucket.core.issues.html.issueinfo(
            issue = None,
            comments = Nil,
            issueLabels = Nil,
            issueAssignees = Nil,
            collaborators = collaborators,
            milestones = milestones.map(x => (x, 0, 0)),
            priorities= priorities,
            defaultPriority = defaultPriority,
            labels = labels,
            customFields = customFields.map((_, None)),
            isManageable = isManageable,
            repository = repository
          )
        </div>
      </div>
    </form>
    <script>
      function checkCustomFieldErrors() {
        let error = false;
        $('.custom-field-error').each(function(i, e) {
          if ($(e).text() != '') {
            error = true;
          }
        });
        return !error;
      }
    </script>
  }
}
